package com.sysh.web.controller;

import com.sysh.entity.Restaurants;
import com.sysh.service.RestaurantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ClassName:  <br/>
 * Function: 功能<br/>
 * date: 2018年01月17日  <br/>
 *
 * @author 苏积钰
 * @since JDK 1.8
 */
@Controller
@RequestMapping("/restaurant")
public class RestaurantController {

    @Autowired
    private RestaurantService restaurantService;

    @GetMapping("/list")
    @ResponseBody
    public Map<String,Object> restaurantList()
    {

        System.out.println("餐馆");
        Map<String,Object> map=new HashMap<>();
        List<Restaurants> list=restaurantService.findAll();
        map.put("restaurant",list);
        return map;
    }
}
